package com.qdd.freight.mapper;

import com.qdd.freight.pojo.ForbiddenRegion;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @InterfaceName LogisticsRegionMapper
 * @Description TODO
 * @Author yanpeihao
 * @Date 2019/12/29 9:46
 * @Version 1.0
 **/
@Repository
public interface ForbiddenRegionMapper extends Mapper<ForbiddenRegion> {

    /**
     * 计算中心获取禁运清单用
     * @return
     */
    @Select("SELECT id,logistics_id,forbidden_addr,forbidden_begin_time,forbidden_end_time from fcs_ship_forbidden where logistics_id = #{logisticsId} " +
            "and NOW() BETWEEN forbidden_begin_time and forbidden_end_time")
    List<String> getLogForAddrList(Integer logisticsId);

    /**
     * 计算中心获取禁运清单用
     * @return
     */

    @Select("SELECT forbidden_addr from fcs_ship_forbidden where delivery_id = #{deliveryId} " +
            "and NOW() BETWEEN forbidden_begin_time and forbidden_end_time")
    List<String> getDelForAddrList(Integer deliveryId);


    //=================================后台管理系统用接口====================================
//    /**
//     *
//     * @param deliveryId
//     * @return
//     */
//        @Select("SELECT id,delivery_id,forbidden_addr,forbidden_begin_time,forbidden_end_time from fcs_ship_forbidden where delivery_id = #{deliveryId} " +
//            "and enabled = '1' and NOW() BETWEEN forbidden_begin_time and forbidden_end_time")
//    List<ForbiddenRegion> getDelForbiddenList(Integer deliveryId);
//
//    /**
//     *
//     * @return
//     */
//    @Select("SELECT id,logistics_id,forbidden_addr,forbidden_begin_time,forbidden_end_time from fcs_ship_forbidden where logistics_id = #{logisticsId} " +
//            "and enabled = '1' and NOW() BETWEEN forbidden_begin_time and forbidden_end_time")
//    List<ForbiddenRegion> getLogForbiddenList(Integer logisticsId);


}
